package com.dawnling.androidutils.ui

import android.graphics.Point
import androidx.appcompat.app.AppCompatActivity

import android.os.Bundle
import com.blankj.utilcode.util.LogUtils

import com.dawnling.androidutils.R
import com.dawnling.androidutils.view.ChooseArea
import kotlinx.android.synthetic.main.activity_choose_area.*

class ChooseAreaActivity : AppCompatActivity(), ChooseArea.IPointChangeListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_choose_area)
        chooseArea.setBottomView(rlAll)
        chooseArea.setRegion(Point(100, 100), Point(300, 100), Point(300, 300), Point(100, 300))
        chooseArea.setPointChangeListener(this@ChooseAreaActivity)
        chooseArea1.setBottomView(rlAll)
        chooseArea1.setRegion(Point(300, 400), Point(600, 400), Point(600, 600), Point(300, 600))
    }

    /**
     * ChooseArea坐标改变监听  ChooseArea1同理
     */
    override fun change(points: Array<out Point>?) {
        if (points != null) {
            for (i in 0 until points.size) {
                LogUtils.e("$i 坐标改变(${points[i].x},${points[i].y})")
            }
        }
    }
}
